<template>
	<view class="detailBox">
		<!-- 订单详细信息：房型照片（轮播图） 房型名称 订单时间 订单用户id 订单用户手机号 订单用户邮箱 订单用户  操作：同意申请 拒绝申请-->
		<u-swiper :list="reserves.houseImg" :effect3d="true" height="399"></u-swiper>
		<view class="reserveInfo">
			<view class="title" style="font-size: 40rpx; font-weight: 550;color: #007AFF; margin-top: 30rpx;">房型名称：<text
					style="font-size: 50rpx;font-weight:600 ; color: black;">{{reserves.houseName}}</text></view>
			<view class="Info" style="font-size: 40rpx; font-weight: 550; color: #007AFF;margin-top: 30rpx;">订单信息：<text
					style="font-size: 40rpx; color: #999999;">{{reserves.reserveInfo}}</text></view>
			<view class="reserveTime" style="font-size: 40rpx; font-weight: 550; color: #007AFF;margin-top: 30rpx;">
				下单时间：<text style="font-size: 40rpx; color: #DD524D;">{{reserves.reserveTime}}</text></view>
		</view>
		<view class="operate">
			<view class="bt1">
				<u-button type="success" @click="toagree">同意预约</u-button>
			</view>
			<view class="bt2">
				<u-button type="error" @click="todisagree">拒绝预约</u-button>
			</view>
			<u-toast ref="uToast" />

		</view>
	</view>
</template>

<script>
	export default {
		onLoad(_options) {
			this.reserves = JSON.parse(_options.reserve)
			console.log(this.reserves)
		},
		data() {
			return {
				reserves: {}
			}
		},
		methods: {
			showToast(path) {
				this.$refs.uToast.show({
					title: '操作成功',
					type: 'success',
					url: path
				})
			},
			toagree() {
				var that = this
				var reserveId = this.reserves.reserveId
				uni.request({
					url: "http://www.zphsow.ltd/api/order/updateStatusById?reserveId="+reserveId+"&reserveStatus="+2,
					method: "POST",
					success(res) {
						if (res.data.result) {
							that.showToast("/pages/Myorder/Myorder")
						} 
					}
				})
			},
			todisagree() {
				var that = this
				var reserveId = this.reserves.reserveId
				uni.request({
					url: "http://www.zphsow.ltd/api/order/updateStatusById?reserveId="+reserveId+"&reserveStatus="+3,
					method: "POST",
					success(res) {
						if (res.data.result) {
							that.showToast("/pages/Myorder/Myorder")
						}
					}
				})
			}

		}
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
	}

	.detailBox {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;

	}

	.reserveInfo {
		margin-top: 20rpx;
		margin-left: 30rpx;
	}

	.operate {
		width: 60%;
		margin-left: 150rpx;
	}

	.bt1 {
		margin-top: 50rpx;
	}

	.bt2 {
		margin-top: 50rpx;
	}
</style>
